package edu.xjtu.jih.signup;

import edu.xjtu.jih.control.user;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface SignUpDao {

    @Select("select count(u_name) from user where u_name = #{u_name}")
    int findUserName(SignUpDto dto);

    @Insert("insert into user(u_id, u_name, u_passord, u_age, u_sex, u_contaction, is_admin) values(#{u_id}, #{u_name}, #{u_pwd}, #{u_age}, #{u_sex}, #{u_contaction}, #{is_admin})")
    void insertUser(SignUpDto dto);

    @Select("select max(u_id) from user")
    int findUserNewID();

    @Select("select * from user where u_id = #{u_id}")
    user findUserbyID(SignUpDto dto);
}